﻿Public Class DataSettings
    Public Shared Adapter As Integer = 0
    Public Shared BildschirmBreite As Integer = 800
    Public Shared BildschirmHoehe As Integer = 600
    Public Shared Resourcenpfad As String = "C:\"
    Public Shared Verhaeltnis As Single = 2 / 3
    Public Shared Streckfaktor As Single = 0
    Public Shared SpielGeschwindigkeit As Integer = 20
    Public Shared ScrollEmpfindlichkeit As Single = 2
    Public Shared MausUmkehren As Integer = -1
    Public Shared AutoEndTurn As Boolean = False
    Public Shared ToolTips As Boolean = True
    Public Shared _2D_3D_Malen As Boolean = False
    Public Shared SprachZuhoeren As Boolean = False
    Public Shared SprachSensitivitaet As Single = 0.9
    Public Shared HideCursor As Boolean = True
    Public Shared Textfliessgeschwindigkeit As Single = 1.0
    Public Shared Autospeichern As Boolean = True
    Public Shared LetztesSpiel As String = ""
    Public Shared KampfAnimationen As Integer
    Public Shared BesetzungsAnimation As Boolean = True
    Public Shared DurchschnittlicheLadeZeit As Long = 100000
    Public Shared Sprache As Integer = 1
    Public Shared Autor As String = "Anonym"
    Public Shared AutoresizeWindow As Boolean = False
    Public Shared MusikSound As Boolean = True
    Public Shared Hintergrundmusik As Boolean = True
    Public Shared CommanderWarsGameModus As Integer = 0
    Public Shared Fenstermodus As Boolean = True
    Public Shared StandardVollbildschirmBreite As Integer = 1280
    Public Shared StandardVollbildschirmHoehe As Integer = 800
    Public Shared CursorImSpielBleiben As Boolean = False
    Public Shared TerrainStyle As Integer = 0
    Public Shared EinheitenListe1 As String = ""
    Public Shared EinheitenListe2 As String = ""
    Public Shared EinheitenListe3 As String = ""
    Public Shared Aufzeichnen As Boolean = True
    Public Shared InfoMenue As Boolean = True
    Public Shared TaskAnzeigenModus As Integer = 0
    Public Shared MaxAutoSpeichern As Integer = 5
    Public Shared KITexte As Integer = 0
    Public Shared Groesse As Size = New Size(800, 600)
    Public Shared ShowInvalidCode As Boolean = True
    Public Shared KonsolenSpielBefehle As Boolean = True
    Public Shared WindowsKonsolenausgabe As Boolean = False
    Public Shared AktivKonsole As System.Windows.Forms.Keys = Keys.Oem5
    Public Shared Screenshot As System.Windows.Forms.Keys = Keys.F8
    Public Shared Oben As System.Windows.Forms.Keys = Keys.Up
    Public Shared Unten As System.Windows.Forms.Keys = Keys.Down
    Public Shared Rechts As System.Windows.Forms.Keys = Keys.Right
    Public Shared Links As System.Windows.Forms.Keys = Keys.Left
    Public Shared Bestaetigen As System.Windows.Forms.Keys = Keys.Space
    Public Shared Abrechen As System.Windows.Forms.Keys = Keys.B
    Public Shared Key_Scrollen As System.Windows.Forms.Keys = Keys.X
    Public Shared Chat As System.Windows.Forms.Keys = Keys.F2
    Public Shared NaechsteEinheit As System.Windows.Forms.Keys = Keys.N
    Public Shared SelectTaste As System.Windows.Forms.Keys = Keys.M

    Public Shared Quicksave1 As System.Windows.Forms.Keys = Keys.F9
    Public Shared Quicksave2 As System.Windows.Forms.Keys = Keys.F11
    Public Shared Quickload1 As System.Windows.Forms.Keys = Keys.F10
    Public Shared Quickload2 As System.Windows.Forms.Keys = Keys.F12
    Public Shared TChat As System.Windows.Forms.Keys = Keys.F3
    Public Shared Schlachtwechsel As System.Windows.Forms.Keys = Keys.Tab

    Public Shared Zurueck As System.Windows.Forms.Keys = Keys.C
    Public Shared Vor As System.Windows.Forms.Keys = Keys.V

    Public Shared LobbyHost As Boolean = False
    Public Shared LobbyServerIP As String = ""

    Public Shared ErsterStart As Boolean = False
    Public Shared TexturQuali As String = "High"
    Public Shared draw3D As Boolean = False
    Public Shared TotalEinfaerben As Boolean = False
    Public Shared Lichtmaus As Boolean = True
    Public Shared AnimGeschw3D As Single = 1
    Public Shared Kriegsnebel3D As Boolean = True
    Public Shared KOTexturen As String = ""
    Public Shared Sub MySettingsIniLoad()
        Dim IniDat As String = My.Application.Info.DirectoryPath
        IniDat += "\Commander Wars.ini"
        If My.Computer.FileSystem.FileExists(IniDat) Then
            Using strR As New IO.StreamReader(IniDat, Hauptmenue.Codierung, True)
                While Not strR.EndOfStream
                    Dim z As String = strR.ReadLine
                    If z.Contains("//") Then z = z.Remove(z.IndexOf("//"))
                    z = z.Trim
                    If z = "" Then Continue While
                    Dim S() As String = z.Split(":")
                    If S.Length = 2 Then
                        SaveIniValue(S(0), S(1))
                    ElseIf S.Length > 2 Then
                        SaveIniValue(S(0), S(1), S(2))
                    End If
                End While
            End Using
            'Nur ein 3D darf aktiv sein.
            If DataSettings._2D_3D_Malen And DataSettings.draw3D Then
                DataSettings._2D_3D_Malen = False
            End If
        End If
    End Sub
    Public Shared Sub MySettingsIniSave()
        Dim IniDat As String = My.Application.Info.DirectoryPath
        IniDat += "\Commander Wars.ini"

        Using strW As New IO.StreamWriter(IniDat, False, Hauptmenue.Codierung)

            strW.WriteLine("//The Ini-File stores all the values of the settings.")
            strW.WriteLine("//Feel free to edit it. The most of it, you can easily change in the option menu.")
            strW.WriteLine("//Some changes may have no effect, because they are overwritten if you start the game.")
            strW.WriteLine("//Some changes may make the game crash. That's why you should better make a copy before changing values.")
            strW.WriteLine("//If you delete this file, nothing will happen, because the values are NOT saved here. They are just overwritten by these values.")
            strW.WriteLine("//If you changed some values here, which make your game crash and you don't have a backup and just deleting this file doesn't help you, you can try to start the game with the Reset parameter. (Just click at ""help"" in the first little window)")
            strW.WriteLine("")

            strW.WriteLine("//You're beatiful username:")
            strW.WriteLine(Konsole.Settings.Autor.ToString + ":" + DataSettings.Autor)
            'so und jetzt einfach alle Eigenschaften abspeichern..
            strW.WriteLine("//Adapter should be the number of your Monitor. 0 by Default")
            strW.WriteLine(Konsole.Settings.Adapter.ToString + ":" + DataSettings.Adapter.ToString)
            strW.WriteLine("//The Screen bounds")
            strW.WriteLine(Konsole.Settings.ScreenWidth.ToString + ":" + DataSettings.BildschirmBreite.ToString)
            strW.WriteLine(Konsole.Settings.ScreenHeight.ToString + ":" + DataSettings.BildschirmHoehe.ToString)
            strW.WriteLine("//Some values, which probably have no effect")
            strW.WriteLine(Konsole.Settings.Resourcepath.ToString + ":" + DataSettings.Resourcenpfad.ToString)
            strW.WriteLine(Konsole.Settings.Screen_ratio.ToString + ":" + DataSettings.Verhaeltnis.ToString)
            strW.WriteLine(Konsole.Settings.Stratch_factor.ToString + ":" + DataSettings.Streckfaktor.ToString)
            strW.WriteLine("//increase this, to make everything faster. (You can't make it as fast as you want, of course. Just as slow as you want :))")
            strW.WriteLine(Konsole.Settings.Game_Speed.ToString + ":" + DataSettings.SpielGeschwindigkeit.ToString)
            strW.WriteLine(Konsole.Settings.Scroll_sensitivity.ToString + ":" + DataSettings.ScrollEmpfindlichkeit.ToString)
            strW.WriteLine("//Invert Mouse, just inverts the scroll-direction")
            strW.WriteLine(Konsole.Settings.Invert_Mouse.ToString + ":" + DataSettings.MausUmkehren.ToString)
            strW.WriteLine("//Speech Recognization - We just removed the link to it, so it won't happen anything, because a lot of your Computers (Win XP by default) haven't installed it. But it worked fine :)")
            strW.WriteLine(Konsole.Settings.Speech_listening.ToString + ":" + DataSettings.SprachZuhoeren.ToString)
            strW.WriteLine(Konsole.Settings.Speech_sensitivity.ToString + ":" + DataSettings.SprachSensitivitaet.ToString)
            strW.WriteLine("")
            strW.WriteLine("//Decides if the Game Ends a Turn automatically")
            strW.WriteLine(Konsole.Settings.Auto_End_Turn.ToString + ":" + DataSettings.AutoEndTurn.ToString)
            strW.WriteLine("//Decides if the Game shows Tooltips")
            strW.WriteLine(Konsole.Settings.Show_Tooltips.ToString + ":" + DataSettings.ToolTips.ToString)
            strW.WriteLine("//Decides if shows the Windows Cursor")
            strW.WriteLine(Konsole.Settings.Hide_Cursor.ToString + ":" + DataSettings.HideCursor.ToString)
            strW.WriteLine("")
            strW.WriteLine(Konsole.Settings.Text_Scroll_speed.ToString + ":" + DataSettings.Textfliessgeschwindigkeit.ToString)
            strW.WriteLine(Konsole.Settings.Autosave.ToString + ":" + DataSettings.Autospeichern.ToString)
            strW.WriteLine(Konsole.Settings.Last_Game.ToString + ":" + DataSettings.LetztesSpiel.ToString)
            strW.WriteLine(Konsole.Settings.Battleanimations.ToString + ":" + DataSettings.KampfAnimationen.ToString)
            strW.WriteLine(Konsole.Settings.Captureanimations.ToString + ":" + DataSettings.BesetzungsAnimation.ToString)
            strW.WriteLine("//The Loading Time in Ticks per Player :) The progressbar just moves because of this value. It stores, how long it needs to load 1 Player and save this.")
            strW.WriteLine(Konsole.Settings.LoadingTime.ToString + ":" + DataSettings.DurchschnittlicheLadeZeit.ToString)
            strW.WriteLine("//Language: 0=German 1=English")
            strW.WriteLine(Konsole.Settings.Language.ToString + ":" + DataSettings.Sprache.ToString)
            strW.WriteLine("//Autor is the name, displayed, if you make maps in the editor. If you play a multiplayer game, this name is used too. Just enter your nickname")
            strW.WriteLine(Konsole.Settings.Autor.ToString + ":" + DataSettings.Autor.ToString)
            strW.WriteLine("//Here you can mute everything")
            strW.WriteLine(Konsole.Settings.Music_Sound.ToString + ":" + DataSettings.MusikSound.ToString)
            strW.WriteLine("//Just the music of the COs")
            strW.WriteLine(Konsole.Settings.Background_music.ToString + ":" + DataSettings.Hintergrundmusik.ToString)
            strW.WriteLine("")
            strW.WriteLine("//How you play Commander Wars")
            strW.WriteLine(Konsole.Settings.Gamemode.ToString + ":" + DataSettings.CommanderWarsGameModus.ToString)
            strW.WriteLine("")
            strW.WriteLine("//Screen Information")
            strW.WriteLine(Konsole.Settings.Windowed.ToString + ":" + DataSettings.Fenstermodus.ToString)
            strW.WriteLine(Konsole.Settings.Fullscreen_Width.ToString + ":" + DataSettings.StandardVollbildschirmBreite.ToString)
            strW.WriteLine(Konsole.Settings.Fullscreen_Height.ToString + ":" + DataSettings.StandardVollbildschirmHoehe.ToString)
            strW.WriteLine("If True Then the Cursor can't leave the Map")
            strW.WriteLine(Konsole.Settings.CursorOnMap.ToString + ":" + DataSettings.CursorImSpielBleiben.ToString)
            strW.WriteLine(Konsole.Settings.Terrain_style.ToString + ":" + DataSettings.TerrainStyle.ToString)
            strW.WriteLine("//Custom Unit Lists")
            strW.WriteLine(Konsole.Settings.Unit_List1.ToString + ":" + DataSettings.EinheitenListe1.ToString)
            strW.WriteLine(Konsole.Settings.Unit_List2.ToString + ":" + DataSettings.EinheitenListe2.ToString)
            strW.WriteLine(Konsole.Settings.Unit_List3.ToString + ":" + DataSettings.EinheitenListe3.ToString)
            strW.WriteLine("//You can record your game and view it afterwards")
            strW.WriteLine(Konsole.Settings.Record.ToString + ":" + DataSettings.Aufzeichnen.ToString)
            strW.WriteLine(Konsole.Settings.InfoMenu.ToString + ":" + DataSettings.InfoMenue.ToString)
            strW.WriteLine(Konsole.Settings.AutoResizeWindow.ToString + ":" + DataSettings.AutoresizeWindow.ToString)
            strW.WriteLine(Konsole.Settings.Taskbarmode.ToString + ":" + DataSettings.TaskAnzeigenModus.ToString)
            strW.WriteLine("//Autosave Information for deleting a previous action")
            strW.WriteLine(Konsole.Settings.StepsBackward.ToString + ":" + DataSettings.MaxAutoSpeichern.ToString)
            strW.WriteLine("")
            strW.WriteLine("//Should the AI speak sometime during a Game.")
            strW.WriteLine(Konsole.Settings.AISpeech.ToString + ":" + DataSettings.KITexte.ToString)
            'Script-Writer:
            strW.WriteLine("")
            strW.WriteLine("//Script-Writer")
            strW.WriteLine(Konsole.Settings.Script_Writer_Size.ToString + ":" + DataSettings.Groesse.Width.ToString + ":" + DataSettings.Groesse.Height.ToString)
            strW.WriteLine(Konsole.Settings.ShowInvalidCode.ToString + ":" + DataSettings.ShowInvalidCode.ToString)
            '3D:
            strW.WriteLine("")
            strW.WriteLine("//3D")
            strW.WriteLine("//the quality of the pictures")
            strW.WriteLine(Konsole.Settings.Quality.ToString + ":" + DataSettings.TexturQuali.ToString)
            strW.WriteLine("//decides weather the game is displayed 3D or 2D")
            strW.WriteLine(Konsole.Settings._3D.ToString + ":" + DataSettings.draw3D.ToString)
            strW.WriteLine("//make all units and buildings totally coloured in the colour of the player")
            strW.WriteLine(Konsole.Settings.Paint_everything.ToString + ":" + DataSettings.TotalEinfaerben.ToString)
            strW.WriteLine("//This has no effect at the moment")
            strW.WriteLine(Konsole.Settings.Mouselighting.ToString + ":" + DataSettings.Lichtmaus.ToString)
            strW.WriteLine(Konsole.Settings.Animation_Speed_3D.ToString + ":" + DataSettings.AnimGeschw3D.ToString)
            strW.WriteLine(Konsole.Settings.Fog_3D.ToString + ":" + DataSettings.Kriegsnebel3D.ToString)
            '2D3D:
            strW.WriteLine("")
            strW.WriteLine("//Draw 2D in 3D for Zoom")
            strW.WriteLine(Konsole.Settings._2D3D.ToString + ":" + DataSettings._2D_3D_Malen.ToString)
            'Tasten:
            strW.WriteLine("")
            strW.WriteLine("")
            strW.WriteLine("//Keys")
            strW.WriteLine(Konsole.Settings.Key_Up.ToString + ":" + DataSettings.Oben.ToString)
            strW.WriteLine(Konsole.Settings.Key_Down.ToString + ":" + DataSettings.Unten.ToString)
            strW.WriteLine(Konsole.Settings.Key_Right.ToString + ":" + DataSettings.Rechts.ToString)
            strW.WriteLine(Konsole.Settings.Key_Left.ToString + ":" + DataSettings.Links.ToString)
            strW.WriteLine("")
            strW.WriteLine(Konsole.Settings.Key_Confirm.ToString + ":" + DataSettings.Bestaetigen.ToString)
            strW.WriteLine(Konsole.Settings.Key_Cancel.ToString + ":" + DataSettings.Abrechen.ToString)
            strW.WriteLine(Konsole.Settings.Key_Backward.ToString + ":" + DataSettings.Zurueck.ToString)
            strW.WriteLine(Konsole.Settings.Key_Forward.ToString + ":" + DataSettings.Vor.ToString)
            strW.WriteLine(Konsole.Settings.Key_Scrollen.ToString + ":" + DataSettings.Key_Scrollen.ToString)
            strW.WriteLine("")
            strW.WriteLine(Konsole.Settings.Key_Next.ToString + ":" + DataSettings.NaechsteEinheit.ToString)
            strW.WriteLine(Konsole.Settings.Key_Select.ToString + ":" + DataSettings.SelectTaste.ToString)
            strW.WriteLine(Konsole.Settings.Key_change_Battlefield.ToString + ":" + DataSettings.Schlachtwechsel.ToString)
            strW.WriteLine("")
            strW.WriteLine(Konsole.Settings.Key_Quicksave1.ToString + ":" + DataSettings.Quicksave1.ToString)
            strW.WriteLine(Konsole.Settings.Key_Quicksave2.ToString + ":" + DataSettings.Quicksave2.ToString)
            strW.WriteLine(Konsole.Settings.Key_Quickload1.ToString + ":" + DataSettings.Quickload1.ToString)
            strW.WriteLine(Konsole.Settings.Key_Quickload2.ToString + ":" + DataSettings.Quickload2.ToString)
            strW.WriteLine("")
            strW.WriteLine(Konsole.Settings.Key_Chat.ToString + ":" + DataSettings.Chat.ToString)
            strW.WriteLine(Konsole.Settings.Key_TeamChat.ToString + ":" + DataSettings.TChat.ToString)
            strW.WriteLine("")
            strW.WriteLine(Konsole.Settings.Key_Screenshot.ToString + ":" + DataSettings.Screenshot.ToString)
            strW.WriteLine("")
            strW.WriteLine("Controls and function of the Console")
            strW.WriteLine(Konsole.Settings.Key_Console.ToString + ":" + DataSettings.AktivKonsole.ToString)
            strW.WriteLine(Konsole.Settings.Use_Windows_Console.ToString + ":" + DataSettings.WindowsKonsolenausgabe.ToString)
            strW.WriteLine("Shell the Console print out the Orders you and the AI do?")
            strW.WriteLine(Konsole.Settings.Show_Orders_during_Game.ToString + ":" + DataSettings.KonsolenSpielBefehle.ToString)
        End Using
    End Sub

End Class
